package cn.lovecyy.mockjson.core.type;

import java.util.HashMap;
import java.util.Map;

/**
 * TypeMockerRegistry
 *
 * @author Yakir
 */
public class TypeMockerRegistry {

	private static final Map<String, TypeMocker> registry = new HashMap<>();
	static {
		register(new IntTypeMocker());
		register(new StringTypeMocker());
		register(new DecimalTypeMocker());
		register(new EnumTypeMocker());
		register(new DateTypeMocker());
		register(new DateTimeTypeMocker());
		register(new CtxTypeMocker());
		register(new PhoneTypeMocker());
		register(new ReferenceTypeMocker());
		register(new RepeatTypeMocker());
		register(new EmailTypeMocker());
		register(new TimestampTypeMocker());
		register(new PlainTypeMocker());
		register(new ZipCodeTypeMocker());
		register(new UuidTypeMocker());
		register(new AddressTypeMocker());
		register(new NameTypeMocker());

	}

	public static void register(cn.lovecyy.mockjson.core.type.TypeMocker mocker) {
		registry.put(mocker.getType(), mocker);
	}

	public static cn.lovecyy.mockjson.core.type.TypeMocker get(String type) {
		return registry.get(type);
	}

}
